﻿using System.IO;

namespace Gamelight.Data
{
	public class WebTextLoader : WebLoader
	{
		private string result = null;

		public WebTextLoader(string url) : base(url) { }

		public WebTextLoader(string url, int maxAttempts, int millisecondsBetweenAttempts) : base(url, maxAttempts, millisecondsBetweenAttempts) { }

		public string Text { get { return this.result; } }

		protected override void ApplyStreamResult(Stream stream)
		{
			StreamReader reader = new StreamReader(stream);
			this.result = reader.ReadToEnd();

			this.complete = true;
		}
	}
}